import { stringify } from 'qs';
import request from '../utils/request';
import { solo } from '../common/solo';

export async function queryProjectNotice() {
  // return request('/api/project/notice');
  return '';
}

export async function queryActivities() {
  // return request('/api/activities');
  return '';
}

export async function queryRule(params) {
  // return request(`/api/rule?${stringify(params)}`);
  return '';
}

export async function removeRule(params) {
  return '';
  // return request('/api/rule', {
  //   method: 'POST',
  //   body: {
  //     ...params,
  //     method: 'delete',
  //   },
  // });
}

export async function addRule(params) {
  return '';
  // return request('/api/rule', {
  //   method: 'POST',
  //   body: {
  //     ...params,
  //     method: 'post',
  //   },
  // });
}

export async function fakeSubmitForm(params) {
  return '';
  // return request('/api/forms', {
  //   method: 'POST',
  //   body: params,
  // });
}

export async function fakeChartData() {
  // return request('/api/fake_chart_data');
  return '';
}

export async function queryTags() {
  // return request('/api/tags');
  return '';
}

export async function queryBasicProfile() {
  // return request('/api/profile/basic');
  return '';
}

export async function queryAdvancedProfile() {
  // return request('/api/profile/advanced');
  return '';
}

export async function queryBasicApplyDetail() {
  // return request('/api/profile/basic');
  return '';

}

export async function queryFakeList(params) {
  // return request(`/api/fake_list?${stringify(params)}`);
  return '';
}

export async function fakeAccountLogin(params) {
  return '';
  // return request('/api/login/account', {
  //   method: 'POST',
  //   body: params,
  // });
}

export async function fakeAccountLogin2(params) {

  return request('http://192.168.2.32:9050/v1/user/create', {
    method: 'POST',
    body: params,
  });
}

export async function fakeRegister(params) {
  return '';
  // return request('/api/register', {
  //   method: 'POST',
  //   body: params,
  // });
}

export async function queryNotices() {
  return '';
  // return request('/api/notices');
}


export async function queryApplyList(params) {
  return request('http://192.168.2.32:9050/v1/user/applyList', {
    method: 'POST',
    body: params,
  });
}

//退出登录
export async function logout() {
  return request(`${solo.baseUrl}user/logout`);
}
//登录
export async function loginToLoki(params) {
  return request(
    `${solo.baseUrl}/user/login`,
     {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//获取登录验证码
export async function fetchCode() {
  return request(`${solo.baseUrl}user/verificationCode`);
}
//业务详情
export async function queryAdvancedApplyDetail(params) {
  return request(`${solo.baseUrl}apply/task/${params.id}`);
}
let token = sessionStorage.getItem("token");
//首页
export async function queryRuleHome() {
  return request(`${solo.baseUrl}task/prolist`);///?token=${token}
}
//渠道列表
export async function queryChannel(params) {
  return request(
    `${solo.baseUrl}/channel/list`,//?token=${token}
    {
      method: 'POST',
      directlyPost: true,
      body: params,     
    });
}
//添加渠道
export async function addChannel(params) {
  // console.log("params  addChannel", params)
  return request(
    `${solo.baseUrl}/channel/create`,
     {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//启动暂停渠道
export async function changeChannelState(params) {
  return request(
    `${solo.baseUrl}/channel/enable`,
     {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//渠道详情
export async function queryDetails(params) {  
  return request(`${solo.baseUrl}channel/show/${params.id}`);
}
//修改渠道信息
export async function changeChannelDetails(params) {
  return request(
    `${solo.baseUrl}channel/update`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//激活渠道
export async function changeChannelActivation(params) {  
  return request(
    `${solo.baseUrl}channel/active`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//用户列表
export async function queryUsers(params) {
  return request(
    `${solo.baseUrl}user/list`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//业务详情
export async function saveApplyDetail(params) {
  return request(`${solo.baseUrl}apply/task/${params.id}`);
}
//客户信息获取
export async function queryCustomer(params) {
  return request(`${solo.baseUrl}apply/custom/show/${params.id}`);
}
//业务信息获取
export async function queryBusiness(params) {
  return request(`${solo.baseUrl}apply/business/show/${params.id}`);
}
//资信信息获取
export async function queryCredit(params) {
  return request(`${solo.baseUrl}apply/credit/show/${params.id}`);
}
//还款能力信息获取
export async function queryAbility(params) {
  return request(`${solo.baseUrl}apply/ability/show/${params.id}`);
}
//担保信息获取
export async function queryGuarantee(params) {
  return request(`${solo.baseUrl}apply/guarantee/show/${params.id}`);
}
//客户电话回访信息获取
export async function customPhoneShow(params) {
  return request(`${solo.baseUrl}apply/custom/call/show/${params.id}`);
}
//业务申请审核意见获取
export async function auditOpinion(params) {
  return request(`${solo.baseUrl}apply/audit/${params.id}`);
}
//业务申请审核记录
export async function approvalRecord(params) {
  return request(`${solo.baseUrl}approval/list/${params.applyId}`);//
}
//已办任务的所属担保公司
export async function getChannelList() {
  return request(`${solo.baseUrl}channel/getChannelList`);//
}
//加载所有的审批意见
export async function showAllAudit(params) {
  return request(`${solo.baseUrl}apply/showALLAudit/${params.applyId}`);//
}

//选择任务执行人
export async function getTaskOperator(params) {
  return request(`${solo.baseUrl}apply/getTaskOperator/${params.taskId}`);//
}
//下载pdf
export async function downloadPDF(params) {
  return request(`${solo.baseUrl}apply/downloadPdf/${params.applyId}`);//
}

//客户电话回访提交
export async function savePhoneAccess(params) {
  return request(
    `${solo.baseUrl}apply/custom/call/save`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//客户信息核实提交
export async function commitCustomer(params) {
  return request(
    `${solo.baseUrl}apply/custom/commit`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//业务信息核实提交
export async function commitBusiness(params) {
  return request(
    `${solo.baseUrl}apply/business/commit`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//资信情况提交
export async function commitCredit(params) {
  return request(
    `${solo.baseUrl}apply/credit/commit`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//还款能力提交
export async function commitAbility(params) {
  return request(
    `${solo.baseUrl}apply/ability/commit`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//担保核实提交
export async function commitGuarantee(params) {
  return request(
    `${solo.baseUrl}apply/guarantee/commit`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//审核意见保存
export async function saveAudit(params) {
  return request(
    `${solo.baseUrl}apply/saveAudit`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//重置用户管理里面的用户密码
export async function changePassword(params) {
  return request(`${solo.baseUrl}user/resetPw/${params.userId}`);
}
//根据支行Id获取支行父级的所有同级组织
export async function getParentBranchList(params) {
  return request(`${solo.baseUrl}branch/getParentBranchList/${params.branchId}`);
}
//获取添加组织时的上级组织
export async function getParentBranch() {
  return request(`${solo.baseUrl}branch/getParentBranch/`);
}
//添加组织节点
export async function addOrganization(params) {
  return request(
    `${solo.baseUrl}branch/create`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//编辑组织节点
export async function update(params) {
  return request(
    `${solo.baseUrl}branch/update`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//添加用户
export async function addUser(params) {
  return request(
    `${solo.baseUrl}user/create`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
} 
//修改用户信息
export async function updateUser(params) {
  return request(
    `${solo.baseUrl}user/update`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
} 
//修改用户状态
export async function changeUserState(params) {
  return request(
    `${solo.baseUrl}user/enable`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//修改密码
export async function updatePassword(params) {
  return request(
    `${solo.baseUrl}user/updatePassWord`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//验证用户名是否存在
export async function existUserName(params) {
  return request(`${solo.baseUrl}user/existUserName/${params.userName}`);
}
//获取激活渠道信息
export async function activeShow(params) {
  return request(`${solo.baseUrl}channel/activeShow/${params.id}`);
}
//添加用户的获取所属组织
export async function getBranchTreeList() {
  return request(`${solo.baseUrl}branch/getBranchTreeList`);
}
//获取岗位列表
export async function getPostListByBranchId(params) {
  return request(`${solo.baseUrl}post/getPostListByBranchId/${params.branchId}`);
}
//获取岗位详情
export async function jobsDetails(params) {
  return request(`${solo.baseUrl}post/detail/${params.postId}`);
}
//删除组织节点
export async function deleteBranch(params) {
  return request(`${solo.baseUrl}branch/delete/${params.branchId}`);
}
//获得上级组织
export async function getEditBranchList(params) {
  return request(`${solo.baseUrl}branch/editBranch/${params.branchId}`);
}
//添加角色
export async function createPostRole(params) {
  return request(
    `${solo.baseUrl}post/createPostRole`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//删除岗位角色
export async function deleteRole(params) {
  return request(
    `${solo.baseUrl}post/deletePostRole`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//修改岗位信息
export async function changeJobsDetails(params) {
  return request(
    `${solo.baseUrl}post/update`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//添加岗位
export async function addJobs(params) {
  return request(
    `${solo.baseUrl}post/create`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//删除岗位
export async function deleteJobs(params) {
  return request(`${solo.baseUrl}post/delete/${params.postId}`);
}

export async function queryBranch(params) {
  return request(
    `${solo.baseUrl}branch/list`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//
export async function queryJobs(params) {
  return request(
    `${solo.baseUrl}post/list`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//征信列表
export async function queryReporting(params) {
  return request(
    `${solo.baseUrl}credit/list`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//视频面签列表
export async function videoSign(params) {
  return request(
    `${solo.baseUrl}videoSign/list`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//面签详情
export async function videoDetails(params) {
  return request(`${solo.baseUrl}videoSign/detail/${params.id}`);
}
//征信详情
export async function showReporting(params) {
  return request(`${solo.baseUrl}credit/show/${params.id}`);
}
//征信意见保存
export async function updata(params) {
  return request(
    `${solo.baseUrl}credit/process`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//征信查询反欺诈列表
export async function fetchThirdData(params) {
  return request(
    `${solo.baseUrl}thirdData/list`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//新增反欺诈筛查
export async function fetchThirdDataCreate(params) {
  return request(
    `${solo.baseUrl}thirdData/create`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}

//反欺诈详情
export async function fetchThirdDataDetails(params) {
  return request(`${solo.baseUrl}thirdData/detail/${params.id}`);
}

//产品列表
export async function queryProduct(params) {
  return request(
    `${solo.baseUrl}product/list`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//添加产品
export async function addProduct(params) {
  return request(
    `${solo.baseUrl}product/create`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//修改产品详情
export async function changeProductDetails(params) {
  return request(
    `${solo.baseUrl}product/update`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//打开或关闭产品
export async function changeProductState(params) {
  return request(
    `${solo.baseUrl}product/open`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//产品详情
export async function queryProductDetails(params) {
  return request(`${solo.baseUrl}product/show/${params.id}`);
}
//角色列表
export async function queryRole() {
  return request(`${solo.baseUrl}role/list`);
}
//添加角色
export async function createRole(params) {
  return request(
    `${solo.baseUrl}role/create`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//修改角色
export async function updateRole(params) {
  return request(
    `${solo.baseUrl}role/update`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//加载角色权限配置数据
export async function getAllMenusByRoleId(params) {
  return request(`${solo.baseUrl}menus/getAllMenusByRoleId/${params.roleId}`);
}
//配置角色的权限
export async function updateResource(params) {
  return request(
    `${solo.baseUrl}role/updateResource`,
    {
      method: 'POST',
      directlyPost: true,
      body: params,
    });
}
//待办任务列表
export async function queryPending(params) {
  return request(
    `${solo.baseUrl}task/list`,
    {
      method: 'POST',
      
      directlyPost: true,
      body: params,
    });
}
//
